package Main;

import java.util.Map;

import org.apache.solr.common.params.CoreAdminParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.ContentStream;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.admin.CoreAdminHandler;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.request.SolrQueryResponse;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.search.SolrIndexSearcher;

public class MyAdminHandler extends CoreAdminHandler {
	/**
	 * @return true, if the changes need to be persisted by the CoreContainer. (use only if solr.xml would be changed because of this action. )
	 *         false, otherwise.   (Use this if unsure or having a read-only access to the CoreContainer like collecting statistics)
	 * 
	 */ 
	protected boolean handleCustomAction(SolrQueryRequest req, SolrQueryResponse rsp) {
		CoreContainer container = super.getCoreContainer(); 
		SolrCore mycore1 = container.getCore("core1");
		SolrCore mycore2 = container.getCore("core2");
		SolrParams params = req.getParams();
		String a = params.get( CoreAdminParams.ACTION );
		if (a.equalsIgnoreCase("mystat"))  {
			// TODO: populate 'rsp' as necessary. 
		} 
		return false;
	}
	
	public static void main1(String[] args) {
		MyAdminHandler m=new MyAdminHandler();
		SolrQueryRequest req=new SolrQueryRequest() {
			
			@Override
			public void setParams(SolrParams arg0) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public long getStartTime() {
				// TODO Auto-generated method stub
				return 0;
			}
			
			@Override
			public int getStart() {
				// TODO Auto-generated method stub
				return 0;
			}
			
			@Override
			public SolrIndexSearcher getSearcher() {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public IndexSchema getSchema() {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public String getQueryType() {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public String getQueryString() {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public String[] getParams(String arg0) {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public SolrParams getParams() {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public String getParamString() {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public String getParam(String arg0) {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public SolrParams getOriginalParams() {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public int getLimit() {
				// TODO Auto-generated method stub
				return 0;
			}
			
			@Override
			public SolrCore getCore() {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public Map<Object, Object> getContext() {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public Iterable<ContentStream> getContentStreams() {
				// TODO Auto-generated method stub
				return null;
			}
			
			@Override
			public void close() {
				// TODO Auto-generated method stub
				
			}
		};
	}
}
